package com.sun.commonadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;


public class MyAdapter2 extends BaseAdapter {
    private LayoutInflater mInflater;
    private List<Been> mDatas;
    private  Context mContext;

    public MyAdapter2(Context context, List<Been> datas) {
        mInflater = LayoutInflater.from(context);
        mDatas = datas;
        this.mContext = context;
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int position) {
        return mDatas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = ViewHolder.get(mContext, convertView, parent, R.layout.items, position);

        Been been = mDatas.get(position);

        ((TextView) holder.getView(R.id.id_title)).setText(been.getTitle());
        ((TextView) holder.getView(R.id.id_desc)).setText(been.getDesc());
        ((TextView) holder.getView(R.id.id_time)).setText(been.getTime());
        ((TextView) holder.getView(R.id.id_phone)).setText(been.getPhone());


        return holder.getmConvertView();
    }


}
